<?php
namespace Admin\Controller;
use Admin\Controller\AdminBaseController;
use Common\Model\FinanceLogModel;
use Common\Model\BonusLogModel;
use Common\Model\BonusTypeModel;
use Common\Model\RechargeLogModel;
use Common\Model\SendLogModel;
use Common\Model\CurrencyModel;
use Common\Model\ChangeSysModel;
use Common\Model\ChangeLogModel;
class FinanceController extends AdminBaseController{
	public function financeLog()
	{
	    if ($_GET['username']) {
           $username=I('username'); 
           $user=$this->findUserByUserName($username);
	       $where['user_id']=$user['id'];
	    }
	    if ($_GET['bonus_id']) {
	       $where['bonus_id']=I('bonus_id');
	    }
	    $list=FinanceLogModel::newSelf()->pagingList($where);
	    $this->assign('list',$list);
		$this->display();
	}
	public function bonusLog()
	{
	    if ($_GET['username']) {
           $username=I('username'); 
           $user=$this->findUserByUserName($username);
	       $where['user_id']=$user['id'];
	    }
	    if ($_GET['add_time']) {
	       $where['add_time']=strtotime(I('add_time'));
	    }
        $bonus_type=BonusTypeModel::newSelf()->getInfo();
        
        $list=BonusLogModel::newSelf()->pagingList($where);

        $this->assign('bonus_type',$bonus_type);
        $this->assign('list',$list);
	    $this->display();
	}
	public function rechargeLog()
	{
	    if ($_GET['username']) {
           $username=I('username'); 
           $user=$this->findUserByUserName($username);
	       $where['user_id']=$user['id'];
	    }
	    if ($_GET['add_time']) {
	       $where['add_time']=strtotime(I('add_time'));
	    }
        
        $list=RechargeLogModel::newSelf()->pagingList($where);

        $this->assign('list',$list);
	    $this->display();
	}
	public function sendLog()
	{
	    if ($_GET['username']) {
           $username=I('username'); 
           $user=$this->findUserByUserName($username);
	       $where['user_id']=$user['id'];
	    }
	    if ($_GET['add_time']) {
	       $where['add_time']=strtotime(I('add_time'));
	    }
        
        $list=SendLogModel::newSelf()->pagingList($where);

        $currency=CurrencyModel::newSelf()->getInfo();
        $this->assign('currency',$currency);
        $this->assign('list',$list);
	    $this->display();
	}
	public function changeLog()
	{
        $currency=CurrencyModel::newSelf()->getInfo();
        $this->assign('currency',$currency);
    
        $change_sys=ChangeSysModel::newSelf()->getInfo();
        $this->assign('change_sys',$change_sys);
    
        $where['user_id']=$_SESSION['USER_KEY_ID'];
    
        $list=ChangeLogModel::newSelf()->pagingList($where);
        $this->assign('list',$list);
        $this->display();
	}
}
